package com.ss.ttm.player;

import android.view.SurfaceHolder;

public class SurfaceLifecycleCallbackProxy implements SurfaceHolder.Callback {
    private SurfaceLifecycleCallback surfaceLifecycleCallback;

    SurfaceLifecycleCallbackProxy(SurfaceLifecycleCallback surfaceLifecycleCallback) {
        this.surfaceLifecycleCallback = null;
        this.surfaceLifecycleCallback = surfaceLifecycleCallback;
    }

    public void surfaceChanged(SurfaceHolder surfaceHolder, int format, int width, int height) {
        if(this.surfaceLifecycleCallback != null) {
            this.surfaceLifecycleCallback.onSurfaceChanged(surfaceHolder);
        }
    }

    public void surfaceCreated(SurfaceHolder surfaceHolder) {
        if(this.surfaceLifecycleCallback != null) {
            this.surfaceLifecycleCallback.onSurfaceCreated(surfaceHolder);
        }
    }

    public void surfaceDestroyed(SurfaceHolder surfaceHolder) {
        if(this.surfaceLifecycleCallback != null) {
            this.surfaceLifecycleCallback.onSurfaceDestroyed(surfaceHolder);
        }
    }
}

